<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="../../../js/jquery.js"></script>
<script type="text/javascript" src="../../../js/jquery-ui-personalized.min.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/lowElectricity.js"></script>
<link type="text/css" href="../../../style/theme/ui.all.css" rel="stylesheet" />
<link type="text/css" href="../style/style.css" rel="stylesheet"/>
<title>低电警告列表</title>
</head>
<body>
	<h1>${dormSupervisor.building.name }的低电警告</h1>
	<div class="ajaxMessage"></div>
	<div class="filterTool filterForm">
		<form action="lowElectricityList.do" method="get" name="lowElectricityDTO">
			<input type="hidden" name="buildingId" value="${dormSupervisor.building.id}"/>
			<select name="type">
				<option selected="selected" value="building">楼栋</option>
				<option value="dormitory">寝室</option>
			</select>
			<span class="dormitoryInput">
				<label for="dormitory">寝室</label>
				<input type="text" name="dormitory" id="dormitory"/>
				<span class="warning"></span>
			</span>
			<label for="fromDate">起始时间</label>
			<input type="text" name="fromDate" id="fromDate" class="datepicker"/>
			<label for="toDate">结束时间</label>
			<input type="text" name="toDate" id="toDate" class="datepicker"/>
			<input type="submit" value="提交" name="submit"></input>
		</form>
	</div>
	<c:choose>
		<c:when test="${!empty lowElectricities.list}">
			<div class="modifyDialog" title="修改低电警告信息">
				<form action="addLowElectricity.do" method="post" name="lowElectricityDTO">
					<input type="hidden" name="id"/>
					<div>
						<div><label for="dormitory">寝室：</label></div>
						<input type="text" id="dormitory" name="dormitory" />*
						<span class="warning"></span>
					</div>
					<div>
						<div><label for="degree">剩余度数：</label></div>
						<input type="text" id="degree" name="degree"/>*
					</div>
					<div>
						<div><label for="date">发布时间：</label></div>
						<input type="text" id="data" class="datepicker" name="date"/>*
					</div>
				</form>
			</div>
			<div><input type="button" name="delete" value="删除"/></div>
			<table border="1px" id="lowElectricityList">
				<thead>
					<tr>
						<td><input type="checkbox" name="checked"/></td>
						<td>ID</td><td>寝室</td><td>剩余度数</td><td>发布时间</td><td>查看/修改</td>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${lowElectricities}" var="lowElectricity">
							<tr index=${lowElectricity.id}>
								<td title="check"><input type="checkbox" index="${lowElectricity.id }"/></td>
								<td title="id">${lowElectricity.id }</td>
								<td title="dormitory">${lowElectricity.dormitory.name }</td>
								<td title="degree">${lowElectricity.degree }</td>
								<td title="date"><fmt:formatDate value="${lowElectricity.date }" pattern="yyyy-MM-dd"/></td>
								<td title="modify"><input type="button" name="modify" index="${lowElectricity.id }" value="查看/修改"/></td>
							</tr>			
					</c:forEach>
				</tbody>
			</table>
			<div><input type="button" name="delete" value="删除"/></div>
		</c:when>
		<c:otherwise>
			<p>暂时没有找到符合条件的低电警告列表</p>
		</c:otherwise>
	</c:choose>
</body>
</html>